<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<%@ include file="/commons/commonEdit.jsp"%>
<%@ include file="/commons/tabs.jsp"%>
<%@ include file="/commons/validation.jsp"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>装修管理手续办理 主页面</title>
<link href="${ctx}/css/grid.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/styles/listTable.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" src="${ctx}/scripts/div/common.js"></script>
<script type="text/javascript" src="${ctx}/scripts/public.js"></script>
<script type="text/javascript" src="${ctx}/scripts/common/prototype.js"></script>
<script type="text/javascript" src="${ctx}/scripts/common.js"></script>
<script type="text/javascript" src="${ctx}/scripts/ajaxException.js"></script>

<script type="text/javascript">

	var requisitionId = "";
	var cur_p = 1;

	function showCycleForward(){ //流程跳转
 		var url = "${ctx}/renovation_renovationForwordAction.do?method=renovationForwordSmall";
		top.windowOpen(url, "renovationForward", "装修流程", 320, 900);
	}
	function cycleForward(url){
   		window.location.href=url;
	}
//-------------------装修手续手理部分------------------------------------------------

	function searchRenRequisition(){ //装修手续办理 查询
		this.cur_p = 1;
		var url = "${ctx}/renovation_renovateRequisitionAction.do?method=setRenReqSearchCondition";
		var params = $("renRequisitionSearchForm").serialize();
		sendAjaxRequest(url,params,refleshRenReqFrame);
	}
	function refleshRenReqFrame(){	//刷新装修手续办理分帧页(带条件)
		var url ="${ctx}/renovation_renovateRequisitionAction.do?method=queryRequisitions&ec_p="+cur_p;
  		document.frames["proceduresRenovationFrm"].document.location.href = url;
	}

	function refleshRenReqNotConFrame(){ //刷新装修手续办理分帧页(无条件,新增操作)
		$('buildingId').value="";
		$('houseNumber').value="";
		$('requisitionState').value="";
		refleshRenReqFrame();
	}


	function forwordRenReqSearchPage(){ //跳转到装修手续办理高级查询页
		var url = "${ctx}/renovation_renovateRequisitionAction.do?method=navigateRenRequisitionSearch";
   		top.windowOpen(url, "renRequisitionSearch", "高级查询", 520, 650,true,"renRequisitionSearchIfm");
	}

	function openRequisitionAdd(){ //打开新增装修申请页面
		var url = "${ctx}/renovation_renovateRequisitionAction.do?method=navigateAddRequisition";
   		top.windowOpen(url, "requisitionAdd", "新增装修申请", 540, 900,true,"requisitionAddIfm");
	}

	function checkEdit(){ //检查是否可修改
		if (requisitionId == ""){
			Alert("请选择一条数据！");
			return ;
		}
		var url = "${ctx}/renovation_renovateRequisitionAction.do?method=checkRequisitionEdit";
		new Ajax.Request(url,
			         { method:'post',
					   parameters:{keyword:requisitionId},
					   onComplete:checkEditReturn
					 });
	}
	function checkEditReturn(response){	//打开修改装修申请页面
		 var flag = response.responseText;
		 if (flag == 'false'){
		 	Alert("只有新建状态的数据才能进行修改！");
		 	return ;
		 }
		var url = "${ctx}/renovation_renovateRequisitionAction.do?method=navigateEditRequisition&keyword="+requisitionId;
   		top.windowOpen(url, "requisitionEdit", "修改装修申请", 540, 900,true,"requisitionEditIfm" );
	}

	function checkDelete(){ //检查是否可删除
		if (requisitionId == ""){
			Alert("请选择一条数据！");
			return ;
		}
		var url = "${ctx}/renovation_renovateRequisitionAction.do?method=checkDelete";
		new Ajax.Request(url,
			         { method:'post',
					   parameters:{keyword:requisitionId},
					   onComplete:checkDeleteReturn
					 });
	}
	function checkDeleteReturn(response){ //删除检查回调
		 var flag = response.responseText;
		 if (flag == "false"){
			AskConfirm("已经缴费，不能删除，确定作废吗?","main","${ctx}/renovation_renovateRequisitionAction.do?method=blankOutRequisition&keyword="+requisitionId);
		 }else if (flag == "true"){
		 	AskConfirm("确定要删除这条记录吗?","main","${ctx}/renovation_renovateRequisitionAction.do?method=deleteRequisition&keyword="+requisitionId);
		 }else{
		 	Alert("只有新建状态且未缴费的数据才可以删除！");
		 }
	}

//----------------证件部分--------------------------------------------

	function searchLicence(){ //许可证查询
		this.cur_p = 1;
		var url = "${ctx}/renovation_certificateAction.do?method=setLicenceSearchCondition";
		var params = $("licenceSearchForm").serialize();
		sendAjaxRequest(url,params,refleshLiceneceFrame);

	}

	function forwordLicenceSearchPage(){//跳转到许可证高级查询页
		var url = "${ctx}/renovation_certificateAction.do?method=navigateLicenceSearch";
   		top.windowOpen(url, "licenceSearch", "高级查询", 450, 390,true,"licenceSearchIfm");
	}

	function refleshLiceneceFrame(){	//刷新出入证办理分帧页
		var url ="${ctx}/renovation_certificateAction.do?method=queryLicence&ec_p="+cur_p;
  		document.frames["proceduresRenovationFrm"].document.location.href = url;
	}



</script>
</head>


<body >
<div class="pageNav_bg">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td id="pageNav_leftimg"><img src="${ctx}/images/ico_zxgl_zxsq.gif" width="46" height="47" /></td>
      <td id="navWord"><span class="page_title">装修手续办理</span></td>
      <td class="pageNav_right"><a href="#" style="CURSOR: hand;" onFocus="this.blur()" onClick="showCycleForward();"><img src="${ctx}/images/charage_buzhou11.gif" border="0"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:showFull_in();"><img id="full_image"  src="${ctx}/images/ico_fullscreen.gif" border="0"/></a></td>
    </tr>
  </table>
</div>

<!---------------------------- 装修申办搜索 ----------------------------->

 <div id="renRequisitionSearchDiv"  style="display:none" >
  <form  id="renRequisitionSearchForm" name="renRequisitionSearchForm"  method="post" action=""  target="proceduresRenovationFrm">
  <table width="100%" border="0" cellpadding="0" cellspacing="0" >
    <tr>
      <td ><table border="0" cellpadding="0" cellspacing="1" >
        <tr>
          <td class="td_search">楼 栋：</td>
          <td class="td_search">
          	<pms:unitedSelect
               		id="buildingId"
               		name="buildingId"
               		optionLabel="name"
               		optionValue="keyword"
               		selectText="请选择..."
               		dataList="${buildingList}"
               		style="width:90px;">
	         </pms:unitedSelect>
         	</td>
          <td class="td_search">房 号：</td>
          <td class="td_search"><input name="houseNumber" id="houseNumber" type="text" class="inputtext" size="16"  onkeydown="javascript:if (event.keyCode==13) searchRenRequisition();" /></td>
          <td class="td_search">审批状态：</td>
          <td class="td_search">
			<pms:unitedSelect
               		id="requisitionState"
               		name="requisitionState"
               		optionLabel="name"
               		optionValue="value"
               		selectText="请选择..."
               		dataList="${requisitionStateList}"
               		style="width:90px;">
	         </pms:unitedSelect>
          </td>
          <td class="td_search">
          <table border="0" cellpadding="0" cellspacing="0" >
              <tr>
	                <td class="buttonOffLeft" id="btn1_11"></td>
	                <td class="buttonOffMiddle" id="btn1_12" onclick="searchRenRequisition()" onblur="btn_change(1)" onMouseOver="btn_change_over(1)" onMouseOut="btn_change_out(1)">
	                	<img src="${ctx}/images/ico_searchico.gif" alt="" border="0" align="absmiddle" /> 查 询</td>
	                <td class="buttonOffRight" id="btn1_13"></td>
               </tr>
           </table>
           </td>
           <td ><table border="0" align="left" cellpadding="0" cellspacing="0">
                    <tr>
                      <td class="buttonOffLeft" id="btn1_21"></td>
                      <td class="buttonOffMiddle" id="btn1_22" onblur="btn_change(2)" onMouseOver="btn_change_over(2)" onMouseOut="btn_change_out(2)">
                      	  <a href="#" onFocus="this.blur()" onClick="forwordRenReqSearchPage();" style="color:#000;">高级查询</a></td>
                      <td class="buttonOffRight" id="btn1_23"></td>
                    </tr>
                </table>
           </td>
         </tr>
       </table>
       </td>
      </tr>
   </table>
   </form>
</div>

<!------------------ 许可证搜索 ------------------------------>
 <div id="LicenceSearchDiv"  style="display:none" >
  <form  id="licenceSearchForm" name="licenceSearchForm"  method="post" action=""  target="proceduresRenovationFrm">
  <table width="100%" border="0" cellpadding="0" cellspacing="0" id="search01" class="bg_search">
    <tr>
      <td ><table border="0" cellpadding="0" cellspacing="1" class="tab_search">
        <tr>
          <td class="td_search">楼 栋：</td>
          <td class="td_search">
          	<pms:unitedSelect
               		id="buildingId"
               		name="buildingId"
               		optionLabel="name"
               		optionValue="keyword"
               		selectText="请选择..."
               		dataList="${buildingList}"
               		style="width:90px;">
	         </pms:unitedSelect>
          </td>
          <td class="td_search">房 号：</td>
          <td class="td_search"><input name="houseNumber" id="houseNumber" type="text" class="inputtext" size="16"  onkeydown="javascript:if (event.keyCode==13) searchLicence();" /></td>
          <td class="td_search">
          <table border="0" cellpadding="0" cellspacing="0" >
              <tr>
	                <td class="buttonOffLeft" id="btn1_11"></td>
	                <td class="buttonOffMiddle" id="btn1_12" onclick="searchLicence();" onblur="btn_change(1)" onMouseOver="btn_change_over(1)" onMouseOut="btn_change_out(1)">
	                	<img src="${ctx}/images/ico_searchico.gif" alt="" border="0" align="absmiddle" /> 查 询</td>
	                <td class="buttonOffRight" id="btn1_13"></td>
               </tr>
           </table>
           </td>
           <td >
           <!--
           <table border="0" align="left" cellpadding="0" cellspacing="0">
                    <tr>
                      <td class="buttonOffLeft" id="btn1_21"></td>
                      <td class="buttonOffMiddle" id="btn1_22" onclick="forwordLicenceSearchPage();" onblur="btn_change(2)" onMouseOver="btn_change_over(2)" onMouseOut="btn_change_out(2)">
                      	  <a href="#" onFocus="this.blur()" onClick=""style="color:#000;">高级查询</a></td>
                      <td class="buttonOffRight" id="btn1_23"></td>
                    </tr>
                </table>
           -->
           </td>
         </tr>
       </table>
       </td>
      </tr>
   </table>
  </form>
</div>

<!---------------------装修申办功能--------------------------->
	<div id="renRequisitionFunction"  style="display:none">
		<table border="0" cellpadding="0" cellspacing="0" id="ico1">
		  <tr>
		  <pms:AuthTag authName="renovation_renovateRequisitionAction.do?method=addRequisition">
		    <td class="toolbarico"><a href="#"  onClick="openRequisitionAdd();" onFocus="this.blur()"><img src="${ctx}/images/ico_newfile.gif" border="0" align="absbottom" alt="新建申请" /></a></td>
		   </pms:AuthTag>
		    <pms:AuthTag authName="renovation_renovateRequisitionAction.do?method=editRequisition">
		    <td class="toolbarico"><a href="#"  onClick="checkEdit();"onFocus="this.blur()"><img src="${ctx}/images/ico_amend.gif" border="0" align="absbottom" alt="修改申请" /></a></td>
		    </pms:AuthTag>
		     <pms:AuthTag authName="renovation_renovateRequisitionAction.do?method=deleteRequisition">
		    <td class="toolbarico"><a href="#" onClick="checkDelete();" onFocus="this.blur()"><img src="${ctx}/images/ico_delete.gif" alt="删除" width="16" height="16" border="0" align="absbottom" /></a></td>
		    </pms:AuthTag>
		    <td class="toolbarico">&nbsp;</td>
		  </tr>
		</table>
	</div>

	<pms:tabPanel  panelId="proceduresRenovationMain" iframeId="proceduresRenovationFrm" defaultHeight="450px"  >
		<pms:AuthTag authName="renovation_renovateRequisitionAction.do?method=navigateEmptyRenovateRequisitionList">
		 <pms:tab caption="装修申办"
		    baseUrl="${ctx}/renovation_renovateRequisitionAction.do?method=navigateEmptyRenovateRequisitionList"
		    tabId="renRequisitionList"
			rightDiv="renRequisitionFunction"
		    defaultTab="true"
		    topDiv="renRequisitionSearchDiv"
		    />
		 </pms:AuthTag>
		 <pms:AuthTag authName="renovation_certificateAction.do?method=navigateLicenceEmptyList">
		 <pms:tab caption="出入证办理"
		    baseUrl="${ctx}/renovation_certificateAction.do?method=navigateLicenceEmptyList"
		    tabId="Licence"
		    topDiv="LicenceSearchDiv"
		  />
		  </pms:AuthTag>
	</pms:tabPanel>
</body>
</html>
